// 定义store
import Vue from 'vue'
import Vuex from 'vuex'
Vue.use(Vuex)
const store = new Vuex.Store({
  state: {
    showlogin: false,
    showregister: false,
    addarticle: false,
    userinfo: {},
    next: () => {},
    headimg: 'static/login.png',
    showindexuid: 0,
    article: {
      msg: '',
      links: [],
      totalcount: 0
    },
    localsetting: {
      backgroundtype: 1,
      backgroundimg: 'static/bg.jpeg',
      diycolor: ''
    }
  },
  mutations: {
    setstates (state, obj) {
      state[obj[0]] = obj[1]
    },
    getarticlelist: function (state, data) {
      state.article.msg = data.topicinfo.topicname
      state.article.links = data.articlelist.list
      state.article.totalcount = Number(data.articlelist.count)
    }
  },
  actions: {
    getarticlelist ({ commit }, data) {
    }
  }
})

export default store
